package main

import (
	"net"
	"fmt"
	"os"
)

func main() {
	server := "127.0.0.1:9998"
	tcpAddr, err := net.ResolveTCPAddr("tcp", server)
	if err != nil {
		fmt.Fprintf(os.Stderr, "Fatal err:%s", err.Error())
		os.Exit(1)
	}

	conn, err := net.DialTCP("tcp", nil, tcpAddr)
	if err != nil {
		fmt.Fprintf(os.Stderr, "Fatal err:%s", err.Error())
		os.Exit(1)
	}


	fmt.Println("connect success")
	serder(conn)
	
}

func serder(conn net.Conn)  {
	words := "hello world"
	conn.Write([]byte(words))
	fmt.Println("sender over.")
}